import request from "@/utils/request";

// 转盘
const lotteryApi = {
	// 转盘列表
	getlist(data : GetlistParams) {
		return request.post<dataResult>({ url: "/api/customer/lottery/getlist", data });
	},
	// 转盘详情
	getdetail(data : GetDetailParams) {
		return request.post<dataResult>({ url: "/api/customer/lottery/getdetail", data });
	},
	// 转盘抽奖
	draw(data : DrawParams) {
		return request.post<dataResult>({ url: "/api/customer/lottery/draw", data, showLoading: false });
	},
	// 抽奖记录
	getrecord(data : GetRecordParams) {
		return request.post<dataResult>({ url: "/api/customer/lottery/getrecord", data });
	},
	// 领取奖品
	claim(data : DrawParams) {
		return request.post<dataResult>({ url: "/api/customer/lottery/claim", data });
	}
};

export default lotteryApi;

interface dataResult {
	data ?: any;
	message : string;
	status : number;
}

interface GetlistParams {
	page : number;
	limit : number;
}

interface GetDetailParams {
	id : number;
}

interface DrawParams {
	id : number;
}

interface GetRecordParams {
	page : number;
	limit : number;
	lottery_id : number;
	type : string;
}

interface DrawParams {
	id : number;
	contents : string[];
}